import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Student student = new Student("史佳鹭", 20, "信息管理与信息系统2102", "2109010223");
        System.out.println(student.getName() + "的年龄是" + student.getAge() + "，专业班级是" + student.getMajor() + "，学号是" + student.getStudentNo());
        System.out.print("223-323+100 之间有 " + student.primeNo() + " 个素数，分别为:");
        student.primeOut();
        System.out.println();
        System.out.println("请输入学号后三位");
        Scanner in = new Scanner(System.in);
        int studentNo = in.nextInt();
        System.out.print("十进制 "+studentNo+" 转换成二进制后的结果为：");
        Binary(studentNo);
    }
    //十进制转二进制
    public static void Binary(int studentNo) {
        int Binary[] = new int[32];
        int count = 0;
        while (studentNo > 0) {
            Binary[31 - count] = studentNo % 2;
            studentNo /= 2;
            count++;
        }
        //观看放便在每8个比特位后加一个空格
        for (int i = 0; i < Binary.length; i++) {
            System.out.print(Binary[i]);
            if((i + 1) % 8 == 0) {
                System.out.print(" ");
            }
        }
    }
}
